import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import dayjs from 'dayjs';
export const columns: BasicColumn[] = [
  {
    title: '姓名',
    dataIndex: 'realName',
    key: 'realName',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '部门',
    dataIndex: 'deptName',
    key: 'deptName',
    width: 120,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '1月',
    dataIndex: '1',
    key: '1',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '2月',
    dataIndex: '2',
    key: '2',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '3月',
    dataIndex: '3',
    key: '3',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '4月',
    dataIndex: '4',
    key: '4',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '5月',
    dataIndex: '5',
    key: '5',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '6月',
    dataIndex: '6',
    key: '6',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '7月',
    dataIndex: '7',
    key: '7',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '8月',
    dataIndex: '8',
    key: '8',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '9月',
    dataIndex: '9',
    key: '9',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '10月',
    dataIndex: '10',
    key: '10',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '11月',
    dataIndex: '11',
    key: '11',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '12月',
    dataIndex: '12',
    key: '12',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '合计',
    dataIndex: 'amount',
    key: 'amount',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
];

const currentYear: any = dayjs().format('YYYY');
const end: number = currentYear - 0;
const begin: number = end - 60;
const years: Recordable[] = [];
for (let i = begin; i <= end; i++) {
  years.push({
    value: String(i),
    label: String(i),
  });
}

export const searchFormSchema: FormSchema[] = [
  {
    field: 'showYear',
    label: '年度',
    component: 'Select',
    colProps: { span: 4 },
    defaultValue: dayjs().format('YYYY'),
    componentProps: {
      showSearch: false,
      options: years,
    },
  },
  {
    field: 'rename',
    label: '姓名',
    component: 'Input',
    colProps: { span: 6 },
  },
];
